/*
 * BoundedParticle.java
 *
 * Created on May 26, 2007, 10:09 AM
 *
 */

package pso;

/**
 *
 * @author Greg Robinson gregarobi@dev.java.net
 */
public abstract class BoundedParticle extends Particle {
    
    //Minimum value for particle's range of motion
    private double[] _minimum;
    //Maximum value for particle's range of motion
    private double[] _maximum;
    
    //Restricts range of particle motion, then sets _position
    private void setPosition(double[] position) {
        for(int i=0;i<position.length;i++){
            if(position[i] < _minimum[i])
                position[i] = _minimum[i];
            if(position[i] > _maximum[i])
                position[i] = _maximum[i];
        }
        _position = position;
    }
    
}
